#ifndef NETWORK_H
#define NETWORK_H

#include "generic_queue.h"
#include "model/dom.h"
#include "model/parser.h"
#include "model/client.h"
#include "model/dom_policy.h"
#include "i_socket.h"

#include <boost/shared_ptr.hpp>
#include <map>

#include <iostream> 
using namespace std;

namespace network {
	class event_handler;
	typedef unsigned int event_type;

	struct message {
		boost::shared_ptr<network::i_socket> sock;
		boost::shared_ptr<network::i_socket> new_sock;
		boost::shared_ptr<model::dom> node;
		network::event_type type;
	};

	struct event {
		event(boost::shared_ptr<model::dom> n, 
		      boost::shared_ptr<network::event_handler> h, 
		      boost::shared_ptr<network::i_socket> s)
		:node(n), handler(h), new_sock(s){

		}
		boost::shared_ptr<model::dom> node;
		boost::shared_ptr<network::event_handler> handler;
		boost::shared_ptr<network::i_socket> new_sock;
	};

	typedef generic_queue<network::message> message_queue;
	typedef generic_queue<network::event> event_queue;
	typedef model::parser<model::dom_policy> dom_parser;

	typedef std::map<boost::shared_ptr<network::i_socket>, model::client*>
		network_client;
}

#endif
